/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2024-04-08 09:19:20
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-05-14 10:49:05
 * @FilePath: \driving-training-admin\src\apis\learnDrivingType\index.ts
 *
 */

import axios from '../../axios/index'

export interface learnDrivingTypeListInterface {
    current?: number
    disable?: number
    size?: number
    productType?: number //1:c1, 2:c2, 3:抵扣卷
    schoolId?: string
}

export interface productPicProps {
    pic: string
    tag: string
}

export interface learnDrivingTypeOperationInterface {
    activePrice?: number //活动价
    city?: string //城市
    cityId?: string //城市id
    classId?: string //班别id
    description?: string //产品描述
    details?: string //介绍说明
    id?: string
    originalPrice?: number //原价
    productName?: string //产品名称
    productPic?: productPicProps[] //产品图片
    productType?: number //1:c1, 2:c2, 3:抵扣卷
    purchaseNum?: string //购买基数
    schoolId?: string
}

//学车类型产品分页列表
export const learnDrivingTypeList = (params: learnDrivingTypeListInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/driveProduct/manage/getPageList',
        params
    })
}

/**
 * 学车类型产品启用-禁用
 * @param disable 0.可用；1.禁用
 * @param id
 * @returns
 */
export const learnDrivingTypeDisable = (disable: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/driveProduct/manage/updateDisable',
        data: { disable, id }
    })
}

//获取单个学车类型产品信息
export const learnDrivingTypeDetailed = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/system/driveProduct/manage/getDetailById',
        params: { id }
    })
}

//新增学车类型产品信息
export const addLearnDrivingType = (data: learnDrivingTypeOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/driveProduct/manage/add',
        data
    })
}

//编辑学车类型产品信息
export const editLearnDrivingTypes = (data: learnDrivingTypeOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/driveProduct/manage/edit',
        data
    })
}
/**
 * 根据驾校id 查询对应的班别下拉列表
 * @param schoolId
 * @returns
 */
export const classTypeListBySchoolId = (schoolId: string) => {
    return axios({
        method: 'get',
        url: '/api/system/class/manage/getList',
        params: { schoolId }
    })
}
